<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>lib/index.js - YUIDoc</title>
    <link rel="stylesheet" href="https://yui-s.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="icon" href="../assets/favicon.ico">
    <script src="https://yui-s.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
                <h1><img src="../assets/css/logo.png" title="YUIDoc" width="117" height="52"></h1>
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: 0.10.0</em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
                    <h2 class="off-left">APIs</h2>
                    <div id="api-tabview" class="tabview">
                        <ul class="tabs">
                            <li><a href="#api-classes">Classes</a></li>
                            <li><a href="#api-modules">Modules</a></li>
                        </ul>
                
                        <div id="api-tabview-filter">
                            <input type="search" id="api-filter" placeholder="Type to filter APIs">
                        </div>
                
                        <div id="api-tabview-panel">
                            <ul id="api-classes" class="apis classes">
                                <li><a href="../classes/CLI.html">CLI</a></li>
                                <li><a href="../classes/DocBuilder.html">DocBuilder</a></li>
                                <li><a href="../classes/DocParser.html">DocParser</a></li>
                                <li><a href="../classes/DocView.html">DocView</a></li>
                                <li><a href="../classes/Files.html">Files</a></li>
                                <li><a href="../classes/Help.html">Help</a></li>
                                <li><a href="../classes/Main.html">Main</a></li>
                                <li><a href="../classes/Options.html">Options</a></li>
                                <li><a href="../classes/Server.html">Server</a></li>
                                <li><a href="../classes/Utils.html">Utils</a></li>
                                <li><a href="../classes/YUIDoc.html">YUIDoc</a></li>
                            </ul>
                
                
                            <ul id="api-modules" class="apis modules">
                                <li><a href="../modules/yuidoc.html">yuidoc</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
                    Show:
                    <label for="api-show-inherited">
                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited
                    </label>
            
                    <label for="api-show-protected">
                        <input type="checkbox" id="api-show-protected">
                        Protected
                    </label>
            
                    <label for="api-show-private">
                        <input type="checkbox" id="api-show-private">
                        Private
                    </label>
                    <label for="api-show-deprecated">
                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated
                    </label>
            
                </div>
            
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
<h1 class="file-heading">File: lib/index.js</h1>

<div class="file">
    <pre class="code prettyprint linenums">
/**
 * Copyright (c) 2011, Yahoo! Inc. All rights reserved.
 * Code licensed under the BSD License:
 * https://github.com/yui/yuidoc/blob/master/LICENSE
 */
&#x27;use strict&#x27;;

/**
Module creates the YUI instance with the required modules, uses them and exports the **Y** to be used
by the _CLI class_ or by extenders: &#x60;require(&#x27;yuidocjs&#x27;);&#x60;
You can use it like this:

    var options = {
        paths: [ &#x27;./lib&#x27; ],
        outdir: &#x27;./out&#x27;
    };

    var Y = require(&#x27;yuidocjs&#x27;);
    var json = (new Y.YUIDoc(options)).run();

@class Main
@exports {YUI} Y A YUI instance
@module yuidoc
*/
//Hacking in debug support
var args = process.argv.slice(2);
var debug = false;

args.forEach(function (item) {
    if (item.toLowerCase() === &#x27;--debug&#x27;) {
        debug = true;
    }
});

var YUI = require(&#x27;yui&#x27; + (debug ? &#x27;/debug&#x27; : &#x27;&#x27;)).YUI;
var path = require(&#x27;path&#x27;);
var fs = require(&#x27;graceful-fs&#x27;);
var metaPath = path.join(__dirname, &#x27;../&#x27;, &#x27;package.json&#x27;);

function log (message, level) {
    if (!message || !level || typeof console[level] !== &#x27;function&#x27;) {
        return;
    }

    if (typeof message === &#x27;object&#x27;) {
        message = JSON.stringify(message);
    }

    console[level](&#x27;%s: %s&#x27;, level, message);
}

process.on(&#x27;uncaughtException&#x27;, function (msg) {
    var meta = JSON.parse(fs.readFileSync(metaPath)),
        inst = YUI(),
        useColor = (Y ? Y.config.useColor : false);

    inst.applyConfig({
        debug: true,
        logFn: log,
        useColor: useColor
    });

    inst.log(&#x27;--------------------------------------------------------------------------&#x27;, &#x27;error&#x27;);
    inst.log(&#x27;An uncaught YUIDoc error has occurred, stack trace given below&#x27;, &#x27;error&#x27;);
    inst.log(&#x27;--------------------------------------------------------------------------&#x27;, &#x27;error&#x27;);
    inst.log(msg.stack || msg.message || msg, &#x27;error&#x27;);
    inst.log(&#x27;--------------------------------------------------------------------------&#x27;, &#x27;error&#x27;);
    inst.log(&#x27;Node.js version: &#x27; + process.version, &#x27;error&#x27;);
    inst.log(&#x27;YUI version: &#x27; + YUI.version, &#x27;error&#x27;);
    inst.log(&#x27;YUIDoc version: &#x27; + meta.version, &#x27;error&#x27;);
    inst.log(&#x27;Please file all tickets here: &#x27; + meta.bugs.url, &#x27;error&#x27;);
    inst.log(&#x27;--------------------------------------------------------------------------&#x27;, &#x27;error&#x27;);

    process.exit(1);
});

var Y = YUI({
    modules: {
        help: {
            fullpath: path.join(__dirname, &#x27;help.js&#x27;)
        },
        options: {
            fullpath: path.join(__dirname, &#x27;options.js&#x27;)
        },
        docparser: {
            fullpath: path.join(__dirname, &#x27;docparser.js&#x27;),
            requires: [&#x27;base-base&#x27;, &#x27;json-stringify&#x27;]
        },
        yuidoc: {
            fullpath: path.join(__dirname, &#x27;yuidoc.js&#x27;)
        },
        &#x27;doc-builder&#x27;: {
            fullpath: path.join(__dirname, &#x27;builder.js&#x27;),
            requires: [&#x27;parallel&#x27;, &#x27;handlebars&#x27;]
        },
        utils: {
            fullpath: path.join(__dirname, &#x27;utils.js&#x27;)
        },
        files: {
            fullpath: path.join(__dirname, &#x27;files.js&#x27;)
        },
        docview: {
            fullpath: path.join(__dirname, &#x27;docview.js&#x27;)
        },
        server: {
            fullpath: path.join(__dirname, &#x27;server.js&#x27;)
        },
        project: {
            fullpath: path.join(__dirname, &#x27;project.js&#x27;)
        }
    },
    logExclude: {
        attribute: true,
        handlebars: true
    },
    logFn: log,
    useSync: true
}).use(&#x27;utils&#x27;, &#x27;docparser&#x27;, &#x27;yuidoc&#x27;, &#x27;doc-builder&#x27;, &#x27;docview&#x27;, &#x27;files&#x27;, &#x27;help&#x27;, &#x27;options&#x27;, &#x27;server&#x27;, &#x27;project&#x27;);

Y.packageInfo = Y.Files.getJSON(metaPath);

module.exports = Y;

    </pre>
</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
